import { request } from "../request";


/**
 * 删除文件接口返回结构
 */
export interface DeleteFileRes {
    code: number;
    message: string;
    data: Record<string, unknown>;
    timestamp: Record<string, unknown>;
}

/**
 * 删除文件
 * @param objectKey 文件的唯一标识
 * @returns 删除结果
 */
export const deleteFileAPI = async (objectKey: string): Promise<DeleteFileRes> => {
    const token = localStorage.getItem("token");
    return request(`/api/file/delete`, {
        method: "delete",
        headers: {
            Authorization: `Bearer ${token}`
        },
        params: {
            objectKey
        }
    });
};